package com.lanyou.esb.datadictionary;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * 接口请求的方法<br>
 * 描述：<br>
 * 0:get;1:head;2:put;3:delete;4:post;5:options;
 * 
 * @author Davey.wu
 */
public enum IfReqType {

	GET("0"), HEAD("1"), PUT("2"), DELETE("3"), POST("4"), OPTIONS("5");

	public static final String TypeCode = "10005";

	public final String ValueCode;

	private IfReqType(String code) {
		this.ValueCode = code;
	}

	public static IfReqType get(String valueCode) throws NoSuchObjectException {
		if (StringUtils.isEmpty(valueCode)) {
			throw new NullPointerException();
		}
		for (IfReqType type : IfReqType.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
